package org.skyeye.modeling.customerized.model;

import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.skyeye.modeling.tools.STextPropertyDescriptor;

public class DVOutput extends SimpleOutput {

	private static Image LIVE_ICON = createImage(DVOutput.class, "icons/live16.gif"); //$NON-NLS-1$
	static final long serialVersionUID = 1;
	public static String ID_V_VALUE = "V_VALUE"; //$NON-NLS-1$
	private String currentValue = "10";

	protected  IPropertyDescriptor[] newDescriptors = null;
	public DVOutput(){
		newDescriptors = new IPropertyDescriptor[1] ;
		STextPropertyDescriptor pValueProp = new STextPropertyDescriptor(ID_V_VALUE, "AV Value","1");
		//pValueProp.setValidator(LogicNumberCellEditorValidator.instance());
		newDescriptors[0] = pValueProp;
		
	}
		
	public Image getIconImage() {
		return LIVE_ICON;
	}

	public boolean getResult() {
		return true;
	}

	public String toString() {
		return "VCC";
	}

	public Object getPropertyValue(Object propName) {
		if (ID_V_VALUE.equals(propName)){
			return getCurrentValue();
		}else{
			return super.getPropertyValue(propName);
		}
	}
	public void setPropertyValue(Object id, Object value) {
		if (ID_V_VALUE.equals(id))
			setCurrentValue((String)value);
		else{
			super.setPropertyValue(id, value);
		}
	}
	public String getCurrentValue(){
		return this.currentValue;
	}
	
	public void setCurrentValue(String val){
		this.currentValue = val;
	}
	
	public IPropertyDescriptor[] getPropertyDescriptors() {
		return newDescriptors;
	}
}
